package Demo2;


class Animal{
    public String name;

}

interface IRunning{
    void run();
}
interface ISwimming{
    void swim();
}
interface IFly{
    void fly();
}
class Dog extends Animal implements IRunning{

    public Dog(String name){
        this.name=name;
    }
    @Override
    public void run() {
        System.out.println(name+"正在用狗腿跑");
    }
}
class Duck extends Animal implements IRunning,IFly,ISwimming{
    public Duck(String name) {
        this.name = name;
    }
    @Override
    public void run() {
        System.out.println(name+"正在用鸭腿跑");
    }

    @Override
    public void swim() {
        System.out.println(name+"正在好好漂");
    }

    @Override
    public void fly() {
        System.out.println(name+"正在用鸭翅膀飞");
    }
}
class Bird extends Animal implements IFly{
    public Bird(String name) {
        this.name = name;
    }
    @Override
    public void fly(){
        System.out.println(name+"正在用鸟翅膀飞");
    }
}
public class Test {
    public static void walk(IRunning run1){
        run1.run();
    }

    public static void main(String[] args) {
        walk(new Dog("gouzi"));
    }

}
